package com.hpu.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hpu.mapper.TbItemMapper;
import com.hpu.pojo.TbItem;
import com.hpu.pojo.TbItemExample;
import com.hpu.pojo.TbItemExample.Criteria;
import com.hpu.service.ItemSerivce;

@Service
public class ItemServiceImpl implements ItemSerivce {

	@Autowired
	private TbItemMapper tbItemMapper;

	@Override
	public TbItem findTbItemById(Long id) {

		// 创建一个封装对象
		TbItemExample example = new TbItemExample();
		Criteria criteria = example.createCriteria();
		// 设置查询条件
		criteria.andIdEqualTo(id);
		// 调用代理类
		List<TbItem> list = tbItemMapper.selectByExample(example);
		return list.get(0);

	}
}
